{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "comprehensive-section",
   "metadata": {},
   "source": [
    "## Description：\n",
    "这个jupyter是FiBiNet模型的demo， 主要包括读取数据， 搭建模型，模型训练和评估三大部分。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "tested-happiness",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.322722Z",
     "start_time": "2021-07-03T10:18:49.922228Z"
    }
   },
   "outputs": [],
   "source": [
    "# python基础包\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# 特征处理与数据集划分\n",
    "from sklearn.preprocessing import OneHotEncoder, MinMaxScaler, StandardScaler, LabelEncoder\n",
    "from sklearn.model_selection import train_test_split\n",
    "from utils import DenseFeat, SparseFeat, VarLenSparseFeat\n",
    "\n",
    "# 导入模型\n",
    "from FiBinet import fibinet\n",
    "#from deepctr.models.fibinet import FiBiNET\n",
    "\n",
    "#from deepctr.feature_column import SparseFeat, DenseFeat, get_feature_names\n",
    "from utils import DenseFeat, SparseFeat, VarLenSparseFeat\n",
    "\n",
    "# 模型训练相关\n",
    "from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau\n",
    "from tensorflow.keras.metrics import AUC\n",
    "from tensorflow.keras.losses import binary_crossentropy\n",
    "from tensorflow.keras.optimizers import Adam\n",
    "\n",
    "# 一些相关设置\n",
    "import warnings\n",
    "plt.style.use('fivethirtyeight')\n",
    "warnings.filterwarnings('ignore')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "sweet-shield",
   "metadata": {},
   "source": [
    "## 导入数据与初步处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "legal-classification",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.338685Z",
     "start_time": "2021-07-03T10:18:53.324402Z"
    }
   },
   "outputs": [],
   "source": [
    "# 简单处理特征， 包括填充缺失值，数值处理， 类别编码\n",
    "def data_process(data_df, dense_features, sparse_features):\n",
    "    # 连续型特征用0填充缺失, 并进行对数转换\n",
    "    data_df[dense_features] = data_df[dense_features].fillna(0.0)\n",
    "    for f in dense_features:\n",
    "        data_df[f] = data_df[f].apply(lambda x: np.log(x+1) if x > -1 else -1)\n",
    "    \n",
    "    # 离散型特征用-1填充，并进行LabelEncoder编码\n",
    "    data_df[sparse_features] = data_df[sparse_features].fillna(\"-1\")\n",
    "    for f in sparse_features:\n",
    "        lbe = LabelEncoder()\n",
    "        data_df[f] = lbe.fit_transform(data_df[f])\n",
    "    \n",
    "    return data_df[dense_features+sparse_features]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "phantom-purpose",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.354955Z",
     "start_time": "2021-07-03T10:18:53.340679Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"读取数据\"\"\"\n",
    "data = pd.read_csv('data/criteo_sample.txt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "coordinated-feelings",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.370599Z",
     "start_time": "2021-07-03T10:18:53.356637Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"划分dense和sparse特征\"\"\"\n",
    "columns = data.columns.values\n",
    "dense_features = [feat for feat in columns if 'I' in feat]\n",
    "sparse_features = [feat for feat in columns if 'C' in feat]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "dying-shanghai",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.418397Z",
     "start_time": "2021-07-03T10:18:53.371598Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"简单的数据预处理\"\"\"\n",
    "train_data = data_process(data, dense_features, sparse_features)\n",
    "train_data['label'] = data['label']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "verbal-friendship",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.434263Z",
     "start_time": "2021-07-03T10:18:53.419300Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"划分数据集\"\"\"\n",
    "trnx, valx, trny, valy = train_test_split(train_data[dense_features+sparse_features], train_data['label'], test_size=0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "certain-report",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:18:53.466184Z",
     "start_time": "2021-07-03T10:18:53.436259Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"特征分组， 分成linear部分和DNN部分(根据实际场景进行选择)，并将分组之后的特征用namedtuple封装起来(DenseFeat, SparseFeat)\"\"\"\n",
    "linear_feature_columns = [SparseFeat(feat, vocabulary_size=data[feat].nunique(), embedding_dim=4)\n",
    "                         for i, feat in enumerate(sparse_features)] + \\\n",
    "                         [DenseFeat(feat, 1, ) for feat in dense_features]\n",
    "\n",
    "dnn_feature_columns = [SparseFeat(feat, vocabulary_size=data[feat].nunique(), embedding_dim=4)\n",
    "                         for i, feat in enumerate(sparse_features)] + \\\n",
    "                         [DenseFeat(feat, 1, ) for feat in dense_features]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "universal-directive",
   "metadata": {},
   "source": [
    "## 模型建立"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "brief-infrared",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:19:03.167035Z",
     "start_time": "2021-07-03T10:18:55.508114Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:\n",
      "The following Variables were used a Lambda layer's call (lambda), but\n",
      "are not present in its tracked objects:\n",
      "  <tf.Variable 'senet_layer/W_1:0' shape=(26, 8) dtype=float32>\n",
      "It is possible that this is intended behavior, but it is more likely\n",
      "an omission. This is a strong indication that this layer should be\n",
      "formulated as a subclassed Layer rather than a Lambda layer.\n",
      "(None, 1300) (None, 1300)\n",
      "Model: \"model\"\n",
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "C1 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C2 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C3 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C4 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C5 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C6 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C7 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C8 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C9 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C10 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C11 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C12 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C13 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C14 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C15 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C16 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C17 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C18 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C19 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C20 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C21 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C22 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C23 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C24 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C25 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "C26 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C1 (Embedding)           (None, 1, 4)         108         C1[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C2 (Embedding)           (None, 1, 4)         368         C2[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C3 (Embedding)           (None, 1, 4)         688         C3[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C4 (Embedding)           (None, 1, 4)         628         C4[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C5 (Embedding)           (None, 1, 4)         48          C5[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C6 (Embedding)           (None, 1, 4)         28          C6[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C7 (Embedding)           (None, 1, 4)         732         C7[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C8 (Embedding)           (None, 1, 4)         76          C8[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C9 (Embedding)           (None, 1, 4)         8           C9[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C10 (Embedding)          (None, 1, 4)         568         C10[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C11 (Embedding)          (None, 1, 4)         692         C11[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C12 (Embedding)          (None, 1, 4)         680         C12[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C13 (Embedding)          (None, 1, 4)         664         C13[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C14 (Embedding)          (None, 1, 4)         56          C14[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C15 (Embedding)          (None, 1, 4)         680         C15[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C16 (Embedding)          (None, 1, 4)         672         C16[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C17 (Embedding)          (None, 1, 4)         36          C17[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C18 (Embedding)          (None, 1, 4)         508         C18[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C19 (Embedding)          (None, 1, 4)         176         C19[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C20 (Embedding)          (None, 1, 4)         16          C20[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C21 (Embedding)          (None, 1, 4)         676         C21[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C22 (Embedding)          (None, 1, 4)         24          C22[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C23 (Embedding)          (None, 1, 4)         40          C23[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C24 (Embedding)          (None, 1, 4)         500         C24[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C25 (Embedding)          (None, 1, 4)         80          C25[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "kd_emb_C26 (Embedding)          (None, 1, 4)         360         C26[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_2 (Concatenate)     (None, 26, 4)        0           kd_emb_C1[0][0]                  \n",
      "                                                                 kd_emb_C2[0][0]                  \n",
      "                                                                 kd_emb_C3[0][0]                  \n",
      "                                                                 kd_emb_C4[0][0]                  \n",
      "                                                                 kd_emb_C5[0][0]                  \n",
      "                                                                 kd_emb_C6[0][0]                  \n",
      "                                                                 kd_emb_C7[0][0]                  \n",
      "                                                                 kd_emb_C8[0][0]                  \n",
      "                                                                 kd_emb_C9[0][0]                  \n",
      "                                                                 kd_emb_C10[0][0]                 \n",
      "                                                                 kd_emb_C11[0][0]                 \n",
      "                                                                 kd_emb_C12[0][0]                 \n",
      "                                                                 kd_emb_C13[0][0]                 \n",
      "                                                                 kd_emb_C14[0][0]                 \n",
      "                                                                 kd_emb_C15[0][0]                 \n",
      "                                                                 kd_emb_C16[0][0]                 \n",
      "                                                                 kd_emb_C17[0][0]                 \n",
      "                                                                 kd_emb_C18[0][0]                 \n",
      "                                                                 kd_emb_C19[0][0]                 \n",
      "                                                                 kd_emb_C20[0][0]                 \n",
      "                                                                 kd_emb_C21[0][0]                 \n",
      "                                                                 kd_emb_C22[0][0]                 \n",
      "                                                                 kd_emb_C23[0][0]                 \n",
      "                                                                 kd_emb_C24[0][0]                 \n",
      "                                                                 kd_emb_C25[0][0]                 \n",
      "                                                                 kd_emb_C26[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "senet_layer (SENETLayer)        (None, 26, 4)        416         concatenate_2[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "bilinear_interaction (BilinearI (None, 325, 4)       5200        senet_layer[0][0]                \n",
      "__________________________________________________________________________________________________\n",
      "bilinear_interaction_1 (Bilinea (None, 325, 4)       5200        concatenate_2[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "I1 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I2 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I3 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I4 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I5 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I6 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I7 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I8 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I9 (InputLayer)                 [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I10 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I11 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I12 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "I13 (InputLayer)                [(None, 1)]          0                                            \n",
      "__________________________________________________________________________________________________\n",
      "flatten_26 (Flatten)            (None, 1300)         0           bilinear_interaction[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "flatten_27 (Flatten)            (None, 1300)         0           bilinear_interaction_1[0][0]     \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_3 (Concatenate)     (None, 2600)         0           flatten_26[0][0]                 \n",
      "                                                                 flatten_27[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_1 (Concatenate)     (None, 13)           0           I1[0][0]                         \n",
      "                                                                 I2[0][0]                         \n",
      "                                                                 I3[0][0]                         \n",
      "                                                                 I4[0][0]                         \n",
      "                                                                 I5[0][0]                         \n",
      "                                                                 I6[0][0]                         \n",
      "                                                                 I7[0][0]                         \n",
      "                                                                 I8[0][0]                         \n",
      "                                                                 I9[0][0]                         \n",
      "                                                                 I10[0][0]                        \n",
      "                                                                 I11[0][0]                        \n",
      "                                                                 I12[0][0]                        \n",
      "                                                                 I13[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_4 (Concatenate)     (None, 2613)         0           concatenate_3[0][0]              \n",
      "                                                                 concatenate_1[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 128)          334592      concatenate_4[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C1 (Embedding)           (None, 1, 1)         27          C1[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C2 (Embedding)           (None, 1, 1)         92          C2[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C3 (Embedding)           (None, 1, 1)         172         C3[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C4 (Embedding)           (None, 1, 1)         157         C4[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C5 (Embedding)           (None, 1, 1)         12          C5[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C6 (Embedding)           (None, 1, 1)         7           C6[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C7 (Embedding)           (None, 1, 1)         183         C7[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C8 (Embedding)           (None, 1, 1)         19          C8[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C9 (Embedding)           (None, 1, 1)         2           C9[0][0]                         \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C10 (Embedding)          (None, 1, 1)         142         C10[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C11 (Embedding)          (None, 1, 1)         173         C11[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C12 (Embedding)          (None, 1, 1)         170         C12[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C13 (Embedding)          (None, 1, 1)         166         C13[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C14 (Embedding)          (None, 1, 1)         14          C14[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C15 (Embedding)          (None, 1, 1)         170         C15[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C16 (Embedding)          (None, 1, 1)         168         C16[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C17 (Embedding)          (None, 1, 1)         9           C17[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C18 (Embedding)          (None, 1, 1)         127         C18[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C19 (Embedding)          (None, 1, 1)         44          C19[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C20 (Embedding)          (None, 1, 1)         4           C20[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C21 (Embedding)          (None, 1, 1)         169         C21[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C22 (Embedding)          (None, 1, 1)         6           C22[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C23 (Embedding)          (None, 1, 1)         10          C23[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C24 (Embedding)          (None, 1, 1)         125         C24[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C25 (Embedding)          (None, 1, 1)         20          C25[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "1d_emb_C26 (Embedding)          (None, 1, 1)         90          C26[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "dropout (Dropout)               (None, 128)          0           dense_1[0][0]                    \n",
      "                                                                 dense_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "concatenate (Concatenate)       (None, 13)           0           I1[0][0]                         \n",
      "                                                                 I2[0][0]                         \n",
      "                                                                 I3[0][0]                         \n",
      "                                                                 I4[0][0]                         \n",
      "                                                                 I5[0][0]                         \n",
      "                                                                 I6[0][0]                         \n",
      "                                                                 I7[0][0]                         \n",
      "                                                                 I8[0][0]                         \n",
      "                                                                 I9[0][0]                         \n",
      "                                                                 I10[0][0]                        \n",
      "                                                                 I11[0][0]                        \n",
      "                                                                 I12[0][0]                        \n",
      "                                                                 I13[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "flatten (Flatten)               (None, 1)            0           1d_emb_C1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_1 (Flatten)             (None, 1)            0           1d_emb_C2[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_2 (Flatten)             (None, 1)            0           1d_emb_C3[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_3 (Flatten)             (None, 1)            0           1d_emb_C4[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_4 (Flatten)             (None, 1)            0           1d_emb_C5[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_5 (Flatten)             (None, 1)            0           1d_emb_C6[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_6 (Flatten)             (None, 1)            0           1d_emb_C7[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_7 (Flatten)             (None, 1)            0           1d_emb_C8[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_8 (Flatten)             (None, 1)            0           1d_emb_C9[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "flatten_9 (Flatten)             (None, 1)            0           1d_emb_C10[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_10 (Flatten)            (None, 1)            0           1d_emb_C11[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_11 (Flatten)            (None, 1)            0           1d_emb_C12[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_12 (Flatten)            (None, 1)            0           1d_emb_C13[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_13 (Flatten)            (None, 1)            0           1d_emb_C14[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_14 (Flatten)            (None, 1)            0           1d_emb_C15[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_15 (Flatten)            (None, 1)            0           1d_emb_C16[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_16 (Flatten)            (None, 1)            0           1d_emb_C17[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_17 (Flatten)            (None, 1)            0           1d_emb_C18[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_18 (Flatten)            (None, 1)            0           1d_emb_C19[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_19 (Flatten)            (None, 1)            0           1d_emb_C20[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_20 (Flatten)            (None, 1)            0           1d_emb_C21[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_21 (Flatten)            (None, 1)            0           1d_emb_C22[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_22 (Flatten)            (None, 1)            0           1d_emb_C23[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_23 (Flatten)            (None, 1)            0           1d_emb_C24[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_24 (Flatten)            (None, 1)            0           1d_emb_C25[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "flatten_25 (Flatten)            (None, 1)            0           1d_emb_C26[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 128)          16512       dropout[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense (Dense)                   (None, 1)            14          concatenate[0][0]                \n",
      "__________________________________________________________________________________________________\n",
      "add (Add)                       (None, 1)            0           flatten[0][0]                    \n",
      "                                                                 flatten_1[0][0]                  \n",
      "                                                                 flatten_2[0][0]                  \n",
      "                                                                 flatten_3[0][0]                  \n",
      "                                                                 flatten_4[0][0]                  \n",
      "                                                                 flatten_5[0][0]                  \n",
      "                                                                 flatten_6[0][0]                  \n",
      "                                                                 flatten_7[0][0]                  \n",
      "                                                                 flatten_8[0][0]                  \n",
      "                                                                 flatten_9[0][0]                  \n",
      "                                                                 flatten_10[0][0]                 \n",
      "                                                                 flatten_11[0][0]                 \n",
      "                                                                 flatten_12[0][0]                 \n",
      "                                                                 flatten_13[0][0]                 \n",
      "                                                                 flatten_14[0][0]                 \n",
      "                                                                 flatten_15[0][0]                 \n",
      "                                                                 flatten_16[0][0]                 \n",
      "                                                                 flatten_17[0][0]                 \n",
      "                                                                 flatten_18[0][0]                 \n",
      "                                                                 flatten_19[0][0]                 \n",
      "                                                                 flatten_20[0][0]                 \n",
      "                                                                 flatten_21[0][0]                 \n",
      "                                                                 flatten_22[0][0]                 \n",
      "                                                                 flatten_23[0][0]                 \n",
      "                                                                 flatten_24[0][0]                 \n",
      "                                                                 flatten_25[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "add_1 (Add)                     (None, 1)            0           dense[0][0]                      \n",
      "                                                                 add[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "dense_3 (Dense)                 (None, 1)            129         dropout[1][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "add_2 (Add)                     (None, 1)            0           add_1[0][0]                      \n",
      "                                                                 dense_3[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_4 (Dense)                 (None, 1)            2           add_2[0][0]                      \n",
      "==================================================================================================\n",
      "Total params: 373,455\n",
      "Trainable params: 373,455\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "\"\"\"构建fibinet模型\"\"\"\n",
    "model = fibinet(linear_feature_columns, dnn_feature_columns)\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "satellite-audience",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:19:10.647135Z",
     "start_time": "2021-07-03T10:19:10.637128Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"设置超参数\"\"\"\n",
    "learning_rate = 0.001\n",
    "batch_size = 32\n",
    "epochs = 50"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "entire-vegetarian",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:19:12.489149Z",
     "start_time": "2021-07-03T10:19:12.451449Z"
    }
   },
   "outputs": [],
   "source": [
    "\"\"\"模型编译\"\"\"\n",
    "model.compile(loss=binary_crossentropy, optimizer=Adam(learning_rate=learning_rate),\n",
    "                      metrics=['binary_crossentropy', AUC(name='auc')])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "colonial-sheffield",
   "metadata": {},
   "source": [
    "## 模型的训练与评估"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "indonesian-greece",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:20:14.728629Z",
     "start_time": "2021-07-03T10:19:14.168853Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/50\n",
      "6/6 [==============================] - 59s 2s/step - loss: 0.6244 - binary_crossentropy: 0.6244 - auc: 0.5746 - val_loss: 1.0027 - val_binary_crossentropy: 1.0027 - val_auc: 0.5584\n",
      "Epoch 2/50\n",
      "6/6 [==============================] - 0s 27ms/step - loss: 0.6367 - binary_crossentropy: 0.6367 - auc: 0.5474 - val_loss: 0.8868 - val_binary_crossentropy: 0.8868 - val_auc: 0.5325\n",
      "Epoch 3/50\n",
      "6/6 [==============================] - 0s 26ms/step - loss: 0.5744 - binary_crossentropy: 0.5744 - auc: 0.5909 - val_loss: 0.8036 - val_binary_crossentropy: 0.8036 - val_auc: 0.5390\n",
      "Epoch 4/50\n",
      "6/6 [==============================] - 0s 28ms/step - loss: 0.6121 - binary_crossentropy: 0.6121 - auc: 0.5370 - val_loss: 0.7601 - val_binary_crossentropy: 0.7601 - val_auc: 0.5584\n",
      "Epoch 5/50\n",
      "6/6 [==============================] - 0s 28ms/step - loss: 0.5367 - binary_crossentropy: 0.5367 - auc: 0.6154 - val_loss: 0.7684 - val_binary_crossentropy: 0.7684 - val_auc: 0.5390\n",
      "Epoch 6/50\n",
      "6/6 [==============================] - 0s 28ms/step - loss: 0.5438 - binary_crossentropy: 0.5438 - auc: 0.6530 - val_loss: 0.7831 - val_binary_crossentropy: 0.7831 - val_auc: 0.5260\n",
      "Epoch 7/50\n",
      "6/6 [==============================] - 0s 28ms/step - loss: 0.5259 - binary_crossentropy: 0.5259 - auc: 0.6839 - val_loss: 0.7865 - val_binary_crossentropy: 0.7865 - val_auc: 0.5065\n",
      "\n",
      "Epoch 00007: ReduceLROnPlateau reducing learning rate to 1.0000000474974514e-05.\n",
      "Epoch 8/50\n",
      "6/6 [==============================] - 0s 29ms/step - loss: 0.4728 - binary_crossentropy: 0.4728 - auc: 0.7122 - val_loss: 0.7867 - val_binary_crossentropy: 0.7867 - val_auc: 0.5065\n",
      "Epoch 9/50\n",
      "6/6 [==============================] - 0s 29ms/step - loss: 0.4843 - binary_crossentropy: 0.4843 - auc: 0.6980 - val_loss: 0.7867 - val_binary_crossentropy: 0.7867 - val_auc: 0.5065\n"
     ]
    }
   ],
   "source": [
    "\"\"\"模型训练\"\"\"\n",
    "callbacks = [\n",
    "    EarlyStopping(monitor='val_loss', patience=5, restore_best_weights=True),   # 早停\n",
    "    ReduceLROnPlateau(monitor='val_loss', patience=3, factor=0.01, verbose=1)\n",
    "]\n",
    "#将输入数据转化成字典的形式输入\n",
    "trnx_model_input = {name: trnx[name] for name in dense_features + sparse_features}\n",
    "valx_model_input = {name: valx[name] for name in dense_features + sparse_features}\n",
    "\n",
    "history = model.fit(\n",
    "                    trnx_model_input, \n",
    "                    trny.values,\n",
    "                    epochs=epochs,\n",
    "                    callbacks=callbacks,  # checkpoint\n",
    "                    batch_size=batch_size,\n",
    "                    validation_split=0.1\n",
    "                    )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "frank-snake",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:20:25.252410Z",
     "start_time": "2021-07-03T10:20:25.092606Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbUAAAE0CAYAAACrRq2gAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0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2LJlC1QqFaZMmVJmm6UfpTJy5EizxwT17dsXAJCUlFTd3SWqVQw1olrWvXv3e3YUad26dbll165dg0qlQnJyMkaMGFGmXnFgXrt2DT179sSVK1fQpk2bSj0Ju3nz5mbviwNOrVbfc12iuoAdRYjIRCqVWiwXRd6loPqBoUZUB126dKncssDAQABAQEAAEhISytS7ePGiWb2WLVsiMTERWq3WVs0lqjMYakR10KlTp3Ds2DHT+8zMTGzYsAFhYWGmS4LDhg3D6dOncejQIVM9jUaDlStXws/PD926dQNQeJ9MrVZj+fLlZbbDMzByNLynRlTLdu/ejcuXL5cp79GjB9q0aQMACAkJwbhx4zB58mRTl/7c3FzMmzfPVP/ll1/Gjz/+iHHjxpl16T9//jxWrFgBmazwn/f48eMRFxeHefPm4dSpU+jbty80Gg0OHDiA0aNHY/z48bWz40S1gKFGVMsWLlxosfzDDz80hVpYWBgeeOABLFy4EElJSWjTpg3Wrl2Lfv36mer7+Phgx44dePvttxEbG4v8/Hx06NABq1evNutAIpVKsX79enz88cfYuHEjtm3bBi8vL/Ts2dN0NkfkKDhOjaiOUalUmDRpEmfMJ6oG3lMjIiKHwVAjIiKHwVAjIiKHwY4iRHUMZ+8gqj6eqRERkcNgqBERkcNgqBERkcNgqBERkcNgqBERkcNgqBERkcP4fwyQSSpHJNcTAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\"\"\"可视化下看看训练情况\"\"\"\n",
    "plt.plot(history.history['loss'])\n",
    "plt.plot(history.history['val_loss'])\n",
    "plt.title('Model loss')\n",
    "plt.ylabel('Loss')\n",
    "plt.xlabel('Epoch')\n",
    "plt.legend(['Train', 'Test'], loc='upper left')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "rapid-landing",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:20:27.528691Z",
     "start_time": "2021-07-03T10:20:27.195349Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1/1 [==============================] - 0s 40ms/step - loss: 0.5517 - binary_crossentropy: 0.5517 - auc: 0.6933\n",
      "val AUC: 0.551656\n",
      "6/6 [==============================] - 0s 6ms/step - loss: 0.5690 - binary_crossentropy: 0.5690 - auc: 0.6044\n",
      "train AUC: 0.569024\n"
     ]
    }
   ],
   "source": [
    "\"\"\"模型评估\"\"\"\n",
    "print('val AUC: %f' % model.evaluate(valx_model_input, valy, batch_size=batch_size)[1])\n",
    "print('train AUC: %f' % model.evaluate(trnx_model_input, trny, batch_size=batch_size)[1])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "industrial-october",
   "metadata": {},
   "source": [
    "## 模型架构"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "possible-anaheim",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-03T10:15:23.878885Z",
     "start_time": "2021-07-03T10:15:09.189Z"
    }
   },
   "outputs": [],
   "source": [
    "from tensorflow import keras\n",
    "keras.utils.plot_model(model, to_file='./fibinet_arc.png', show_shapes=True)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
